<%@ page import="books4africa.Ranking" %>
<!doctype html>
<html>
      <head>
            <meta name="layout" content="main">
            <g:set var="entityName" value="${message(code: 'ranking.label', default: 'Ranking')}" />
            <title><g:message code="default.show.label" args="[entityName]" /></title>
      </head>
      <body>
            <a href="#show-ranking" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
            <div class="nav" role="navigation">
                  <ul>
                        <li><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
                  </ul>
            </div>
            <div id="list-ranking" class="content scaffold-list" role="main">
                  <h1>${bookResult.title } Rankings</h1>
                  <g:if test="${flash.message}">
                  <div class="message" role="status">${flash.message}</div>
                  </g:if>
                  <table>
                        <thead>
                              <tr>
                              
                              
                                    <th><g:message code="ranking.rank.label" default="Ranking" /></th>
                                    <th><g:message code="ranking.comment.label" default="Rank Comments" /></th>
                                    <th><g:message code="ranking.book.label" default="Book" /></th>
                              
                                    <th><g:message code="ranking.dateCreated.label" default="Date Created" /></th>
                                    <th><g:message code="ranking.user.label" default="User" /></th>
                              
                              </tr>
                        </thead>
                        <tbody>
                        <g:each in="${rankingInstanceList}" status="i" var="rankingInstance">
                              <tr class="${(i % 2) == 0 ? 'even' : 'odd'}">
                              
                                  <td>${fieldValue(bean: rankingInstance, field: "rank")}</td>
                                    
                                    <td>${fieldValue(bean: rankingInstance, field: "comment")}</td>
                              
                                    <td>${fieldValue(bean: rankingInstance, field: "book")}</td>
                              
                                    <td><g:formatDate date="${rankingInstance.dateCreated}" type="date" style="MEDIUM"/></td>
                              
                                    <td>${fieldValue(bean: rankingInstance, field: "user")}</td>
                              
                              </tr>
                        </g:each>
                        </tbody>
                  </table>
            </div>
            
            <div id="create-ranking" class="content scaffold-create" role="main">
                  <h1>Create a new ranking for ${bookResult.title }</h1>
                  <g:if test="${flash.message}">
                  <div class="message" role="status">${flash.message}</div>
                  </g:if>
                  <g:hasErrors bean="${rankingInstance}">
                  <ul class="errors" role="alert">
                        <g:eachError bean="${rankingInstance}" var="error">
                        <li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>><g:message error="${error}"/></li>
                        </g:eachError>
                  </ul>
                  </g:hasErrors>
                  <g:form action="save" >
                        <fieldset class="form">
                              <g:hiddenField name="bookId" value="${bookResult?.id}"/>
                              <g:render template="form"/>
                        </fieldset>
                        <fieldset class="buttons">
                              <g:submitButton name="cancel" class="cancel" value="${message(code: 'Cancel', default: 'Cancel')}" />
                              <g:submitButton name="create" class="save" value="${message(code: 'Save Ranking', default: 'Save Ranking')}" />
                        </fieldset>
                  </g:form>
            </div>
            
      </body>
</html>
